﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.Data.DbUtils.DataMapping;
using PMS.Data.Entities.Customers;

namespace PMS.Data.EntityMap.Customers
{
    /// <summary>
    /// Represents a Organize mapping configuration
    /// </summary>
    public partial class OrganizeMap : PMSEntityTypeConfiguration<Organize>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<Organize> builder)
        {
            builder.ToTable("bus_organize");
            builder.HasKey(organize => organize.Id);

            builder.Property(organize => organize.Name).HasMaxLength(32).IsRequired();
            builder.Property(organize => organize.DisplayName).HasMaxLength(32);
            builder.Property(organize => organize.ParentId).IsRequired();
            builder.Property(organize => organize.DisplayOrder).IsRequired();
            builder.Property(organize => organize.IsActive).IsRequired();
            builder.Property(organize => organize.CreatedOnTimeUtc).IsRequired();
            builder.Property(organize => organize.UpdatedOnTimeUtc).IsRequired();

            base.Configure(builder);
        }

        #endregion
    }
}
